package com.aps.server.parse.model;

import com.aps.server.parse.ann.ExcelColumn;
import lombok.Data;

import java.lang.reflect.Field;

/**
 * @Author nbZhuozh
 * @Date 2025-09-01  15:56
 **/
@Data
public class ExcelColumnConfig {
    private String field;        // 字段名
    private String label;        // 列标题
    private String sampleValue;  // 示例值
    private Class<?> type;       // 数据类型

    protected ExcelColumnConfig(String field, String label, String sampleValue, Class<?> type) {
        this.field = field;
        this.label = label;
        this.sampleValue = sampleValue;
        this.type = type;
    }

    /**
     * builder fucker
     * @param field
     * @param excelColumn
     * @return
     */
    public static ExcelColumnConfig builder(Field field, ExcelColumn excelColumn) {
        return new ExcelColumnConfig(field.getName(),excelColumn.value(), excelColumn.defaultSampleValue(),field.getType());
    }

}
